<!DOCTYPE HTML>
<html style="background-color:rgb(249,249,251)">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Myprase</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" href="../../css/font-awesome.min.css">
</head>
<style media="screen">
    .newsicon {
        width: 1rem;
        float: left;
        margin-top: 0.7rem;
        margin-left: 0.75rem
    }

    .newaui {
        border: 0rem solid red;
        background-color: #ffffff;
    }
</style>

<body style="background-color:rgb(249,249,251)">
    <header class="aui-bar aui-bar-nav" style="background-color:white;position:fixed;z-index:2;height:2.5rem;padding-top:0.8rem">
        <a class="aui-pull-left aui-btn" onclick="api.closeWin()">
            <i style="color:black" class="fa fa-chevron-left" aria-hidden="true"></i>
        </a>
        <div class="aui-title" style="color:black">我的点赞</div>
        <a class="aui-pull-right">
            <span>
              <img src="../../image/321AC.png" style="padding-top:0.25rem;">
          </span>
        </a>
    </header>
    <section class="aui-content" style="width:95%;margin:auto;padding-bottom:3rem;">
        <div class="aui-card-list">
            <div class="aui-card-list-content-padded">
                <div class="aui-content" id="demo">
                    <ul class="aui-list aui-media-list" style="margin-top:2rem">
                        <li class="aui-list-item" v-for="item in activities">
                            <div class="aui-media-list-item-inner">
                                <div class="aui-list-item-media" style="width:5rem;height:4.0rem" @click="changetoAD($index)">
                                    <img :src="item.imagearray[0]" style="width:100%;height:100%">
                                </div>
                                <div class="aui-list-item-inner">
                                    <div class="aui-list-item-text"  @click="changetoAD($index)">
                                        <div class="aui-list-item-title">{{item.title}}</div>
                                        <!-- 走进课堂 -->
                                    </div>
                                    <div class="aui-list-item-text"  @click="changetoAD($index)">
                                        {{item.type}}
                                    </div>
                                    <!-- 超级管理员01 -->
                                    <div class="aui-info" style="padding:0rem;padding-right:1rem;">
                                        <!-- <i class="fa fa-thumbs-o-up" aria-hidden="false" >{{item.prasecount}}</i> -->
                                        <i v-if="item.praseif=='false'" class="fa fa-thumbs-o-up" aria-hidden="false" style="color:#757575" @click="prase($event,$index)">{{item.prasecount}}</i>
                                        <i v-else="item.praseif=='true'" class="fa fa-thumbs-o-up" aria-hidden="false" style="color:red" @click="prase($event,$index)">{{item.prasecount}}</i>
                                        <i class="fa fa-star-o" aria-hidden="true" style="left:3%"@click="store()">{{item.storecount}}</i>
                                        <i class="fa fa-commenting-o" aria-hidden="true" style="left:5%"@click="comment()"> {{item.commentcount}}</i>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </section>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/aui-slide.js"></script>
<script type="text/javascript" src="../../script/vue1.0.js"></script>
<script type="text/javascript" src="../../script/util.js"></script>
<script type="text/javascript" src="../../script/common1.js"></script>
<script type="text/javascript" src="../../script/constant.js"></script>
<script type="text/javascript">
var pclickcount = 0;
var sclickcount = 0;
var cclickcount = 0;
var ptype = "";
    apiready = function() {
        var user = api.getPrefs({
            key: 'user',
            sync: true
        });
        var USER = JSON.parse(user);
        var length = 0;
        vm = new Vue({
            el: "body",
            data: {
                activities: [],
            },
            methods: {
                changetoAD: function(index) {
                    api.openWin({
                        name: 'ActivitiesDetails',
                        url: '../activityList/ActivitiesDetails.html',
                        pageParam: {
                            index: index,
                            type: 3
                        }
                    });
                },
                //点赞
                prase: function (ev, index) {
                    var me = this;
                    if (ev.currentTarget.style.color != 'red') {
                        ev.currentTarget.style = "color:red";
                        ptype = "0";
                        api.ajax({
                            url: serverIp + '/friend/changepraseActivity.do',
                            method: 'post',
                            data: {
                                values: {
                                    type: ptype,
                                    activityoid: me.activities[index].oid,
                                }
                            }
                        }, function (ret, err) {
                            if (ret) { }
                        });
                        ptype = "1";
                        zancount = Number(me.activities[index].prasecount)
                        me.activities[index].prasecount = zancount + 1;
                    } else {
                        ev.currentTarget.style = "color:#757575";
                        ptype = "1";
                        api.ajax({
                            url: serverIp + '/friend/changepraseActivity.do',
                            method: 'post',
                            data: {
                                values: {
                                    type: ptype,
                                    activityoid: me.activities[index].oid,
                                    userId: USER.userId
                                }
                            }
                        }, function (ret, err) {
                            if (ret) { }
                        });
                        ptype = "0";
                        zancount = Number(me.activities[index].prasecount)
                        me.activities[index].prasecount = zancount - 1;
                    }
                },
                get: function() {
                    var me = this;
                    $api.get(serverIp + '/friend/listMypraseActivity.do', function(ret) {
                        if (ret) {
                            length = ret.length;
                            if (ret.length == 0) {
                                section = $api.byId('section');
                                var str = "<div  style='width:100%;height:10rem;margin:0 auto;margin-top:1rem;'><img src='../../image/nothing.gif'  style='width:100%;height:100%'></div>"
                                $api.prepend(section, str);

                            }
                            me.activities = ret;
                           
                            for (var i = 0; i < me.activities.length; i++) {
                                imagearray = me.activities[i].imagePaths.split(',');
                                me.activities[i].imagearray = imagearray;
                                ret[i].imagearray = imagearray;
                            }
                            api.setPrefs({
                                key: 'activities3',
                                value: ret
                            });
                        }
                        api.hideProgress();
                    }, 'JSON');
                }

            },
            created: function() {
                var me = this;
                api.showProgress({
                    title: '努力加载中...',
                    text: '先喝杯茶...',
                    modal: false
                });
                me.get();
            }
        });
        //vue结束


        //上拉加载
        api.addEventListener({
            name: 'scrolltobottom',
            extra: {
                threshold: 0
            }
        });

    };
    //apiready结束
</script>

</html>
